/*
 * VEML6046X00_Prototypes.h
 *
 * Created  : 6 March 2023
 * Modified : 2 June 2023
 * Author   : HWanyusof
 * Version	: 1.3
 */

#include "typedefinition.h"

/*Switch the sensor on/off
 *VEML6046X00_SET_RGB_ON_0(Byte RGB_ON_0_Bit)
 *Byte RGB_ON_0_Bit - Input Parameter:
 *
 * VEML6046X00_RGB_ON_0_DIS
 * VEML6046X00_RGB_ON_0_EN
 *
 */
void VEML6046X00_SET_RGB_ON_0(Byte RGB_ON_0_Bit);

/*Switch the sensor on/off
 *VEML6046X00_SET_RGB_ON_1(Byte RGB_ON_1_Bit)
 *Byte RGB_ON_1_Bit - Input Parameter:
 *
 * VEML6046X00_RGB_ON_1_DIS
 * VEML6046X00_RGB_ON_1_EN
 *
 */
void VEML6046X00_SET_RGB_ON_1(Byte RGB_ON_1_Bit);

/*Set the Integration Time
 *VEML6046X00_SET_RGB_IT(Byte IntTime)
 *Byte IntTime - Input Parameter:
 *
 * VEML6046X00_RGB_IT_3_125ms
 * VEML6046X00_RGB_IT_6_25ms
 * VEML6046X00_RGB_IT_12_5ms
 * VEML6046X00_RGB_IT_25ms
 * VEML6046X00_RGB_IT_50ms
 * VEML6046X00_RGB_IT_100ms
 * VEML6046X00_RGB_IT_200ms
 * VEML6046X00_RGB_IT_400ms
 */
void VEML6046X00_SET_RGB_IT(Byte IntTime);

/*Set the measurement mode of the sensor
 *VEML6046X00_SET_RGB_MODE(Byte Mode)
 *Byte Mode - Input Parameter:
 *
 * VEML6046X00_RGB_AUTO_MODE
 * VEML6046X00_RGB_AF_MODE
 */
void VEML6046X00_SET_RGB_MODE(Byte Mode);

/*Set the active force mode trigger
 *VEML6046X00_SET_RGB_TRIG(Byte TriggerBit)
 *Byte TriggerBit - Input Parameter:
 *
 * VEML6046X00_RGB_TRIG_DIS
 * VEML6046X00_RGB_TRIG_EN
 */
void VEML6046X00_SET_RGB_TRIG(Byte TriggerBit);

/*Enable / disable the green channel interrupt
 *VEML6046X00_SET_RGB_INT(Byte Interrupt)
 *Byte Interrupt - Input Parameter:
 *
 * VEML6046X00_RGB_INT_DIS
 * VEML6046X00_RGB_INT_EN
 */
void VEML6046X00_SET_RGB_INT(Byte Interrupt);

/*Set the effective photodiode size for the R,G,B and IR channel
 *VEML6046X00_SET_PD_DIV(Byte PD_Size)
 *Byte PD_Size - Input Parameter:
 *
 * VEML6046X00_PD_DIV_FULL
 * VEML6046X00_PD_DIV_HALF
 */
void VEML6046X00_SET_PD_DIV(Byte PD_Size);

/*Set the gain of the RGB
 *VEML6046X00_SET_RGB_GAIN(Byte Gain)
 *Byte Gain - Input Parameter:
 *
 * VEML6046X00_RGB_GAIN_x0_5
 * VEML6046X00_RGB_GAIN_x0_66
 * VEML6046X00_RGB_GAIN_x1
 * VEML6046X00_RGB_GAIN_x2
 */
void VEML6046X00_SET_RGB_GAIN(Byte Gain);

/*Set the amount of consecutive threshold crossing events necessary to trigger the green channel interrupt
 *VEML6046X00_SET_RGB_PERS(Byte Pers)
 *Byte Pers - Input Parameter:
 *
 * VEML6046X00_RGB_PERS_1
 * VEML6046X00_RGB_PERS_2
 * VEML6046X00_RGB_PERS_4
 * VEML6046X00_RGB_PERS_8
 */
void VEML6046X00_SET_RGB_PERS(Byte Pers);

/*Set the internal calibration after power on
 *VEML6046X00_SET_RGB_CAL(Byte rgb_cal)
 *Byte rgb_cal - Input Parameter:
 *
 * VEML6046X00_RGB_CAL_OFF
 * VEML6046X00_RGB_CAL_ON
 */
void VEML6046X00_SET_RGB_CAL(Byte rgb_cal);

/*Set the high threshold green channel interrupt value
 *VEML6046X00_SET_RGB_HighThreshold(Word HighThreshold)
 *Word HighThreshold - Input Parameter:
 *
 * Value between 0d0 and 0d65535
 */
void VEML6046X00_SET_RGB_HighThreshold(Word HighThreshold);

/*Set the low threshold green channel interrupt value
 *VEML6046X00_SET_RGB_LowThreshold(Word LowThreshold)
 *Word LowThreshold - Input Parameter:
 *
 * Value between 0d0 and 0d65535
 */
void VEML6046X00_SET_RGB_LowThreshold(Word LowThreshold);

/*Read the red channel output data
 *VEML6046X00_GET_R_DATA() returns Red Channel Data between 0d0 and 0d65535
 */
Word VEML6046X00_GET_R_DATA();

/*Read the green channel output data
 *VEML6046X00_GET_G_DATA() returns Green Channel Data between 0d0 and 0d65535
 */
Word VEML6046X00_GET_G_DATA();

/*Read the blue channel output data
 *VEML6046X00_GET_B_DATA() returns Blue Channel Data between 0d0 and 0d65535
 */
Word VEML6046X00_GET_B_DATA();

/*Read the IR channel output data
 *VEML6046X00_GET_IR_DATA() returns IR Channel Data between 0d0 and 0d65535
 */
Word VEML6046X00_GET_IR_DATA();

/*Read Device ID
 *Returns ID
 */
Word VEML6046X00_GET_ID();

/*Read the RGB Interrupt Flag
 *VEML6046X00_GET_INT_FLAG() returns interrupt flag status.
 *Please refer to Table 11 in the Datasheet page 11
 */
Byte VEML6046X00_GET_INT_FLAG();

/*Read register value
 *VEML6046X00_READ_Reg(Byte Reg)
 *Byte Reg - Input Parameter:
 *
 * VEML6046X00_RGB_CONF_0		0x00
 * VEML6046X00_RGB_THDH_L		0x04
 * VEML6046X00_RGB_THDL_L	    0x06
 * VEML6046X00_R_DATA_L	        0x10
 * VEML6046X00_G_DATA_L	        0x12
 * VEML6046X00_B_DATA_L	        0x14
 * VEML6046X00_IR_DATA_L	    0x16
 * VEML6046X00_ID_L		        0x18
 * VEML6046X00_INT_FLAG		    0x1B
 *
 *returns Register Value between 0d0/0x00 and 0d65535/0xFFFF
 */
Word VEML6046X00_READ_Reg(Byte Reg);

/*Read the RGB_ON_0 bit
 *returns 1 for Shutdown and 0 for Sensor On
 */
bool VEML6046X00_GET_RGB_ON_0_Bit();

/*Read the RGB_ON_1 bit
 *returns 1 for Shutdown and 0 for Sensor On
 */
bool VEML6046X00_GET_RGB_ON_1_Bit();

/*Read the RGB_MODE bit
 *returns 1 for AF Mode and 0 for Auto Mode
 */
bool VEML6046X00_GET_RGB_MODE_Bit();

/*Read the RGB_IT bits
 *returns 0d0 - 0d8 depending on RGB_IT bits
 */
int VEML6046X00_GET_RGB_IT_Bits();

/*Read the RGB_GAIN bits
 *returns 0d0 - 0d4 depending on RGB_GAIN bits
 */
int VEML6046X00_GET_RGB_GAIN_Bits();

/*Read the PD_DIV bits
 *returns 1 for 1/2 PD size being used and 0 for full (2/2) PD size being used
 */
bool VEML6046X00_GET_PD_DIV_Bits();

/*Read the AF_DATA_READY flag
 *returns 1 for AF_DATA_READY flag and 0 for no AF_DATA_READY flag
 */
bool VEML6046X00_GET_AF_DATA_READY_FLAG();
